import 'package:flutter/material.dart';

import 'package:fluro/fluro.dart';
import 'package:provide/provide.dart';

import './provide/currentIndex.dart';
import './provide/userProvide.dart';
import './routers/application.dart';
import './routers/routers.dart';

import './pages/index_page.dart';

void main() {
  var providers = Providers();

  providers..provide(Provider.function((context) => CurrentIndexProvide()));
  providers..provide(Provider.function((context) => UserProvide()));

  runApp(ProviderNode(child: MyApp(), providers: providers));
}

class MyApp extends StatelessWidget {
  //初始化路由

  @override
  Widget build(BuildContext context) {
    final router = Router();
    Routes.configureRoutes(router);
    Application.router = router;

    return Container(
      child: MaterialApp(
        title: '校园共享单车',
        initialRoute: "/",
        onGenerateRoute: Application.router.generator, //路由拦截器
        debugShowCheckedModeBanner: false,
        theme: ThemeData(primaryColor: Colors.pink),
        home: IndexPage(),
      ),
    );
  }
}
